//
//  MessageGoodsTableViewCell.m
//  GLGW_Shoping
//
//  Created by yang on 2018/11/20.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "MessageGoodsTableViewCell.h"

@implementation MessageGoodsTableViewCell{
    GLGWLabel * timeLabel;
    GLGWLabel * goodsTitleLabel;
    GLGWLabel * goodsNameLabel;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        timeLabel = [[GLGWLabel alloc] initWithFrame:CGRectMake(kWidthProportion_In_iPhoneTriploid(88), kHeightProportion_In_iPhoneTriploid(15), KScreenWidth - kWidthProportion_In_iPhoneTriploid(176), kHeightProportion_In_iPhoneTriploid(30)) theFont:SYSTEMFONT(14) theColor:[UIColor whiteColor] inSuperView:self];
        timeLabel.layer.masksToBounds = YES;
        timeLabel.textAlignment = NSTextAlignmentCenter;
        timeLabel.layer.cornerRadius = kHeightProportion_In_iPhoneTriploid(15);
        timeLabel.backgroundColor = [UIColor colorWithHexString:@"#000000" alpha:0.3];
        timeLabel.text = @"2018年09月12日 12:23";
        //
        GLGWView * bankgroundView = [[GLGWView alloc] initWithFrame:CGRectMake(kWidthProportion_In_iPhoneTriploid(15), kY_With_View(timeLabel, 15), KScreenWidth - kWidthProportion_In_iPhoneTriploid(30), kHeightProportion_In_iPhoneTriploid(75)) inSuperView:self];
        bankgroundView.backgroundColor = [UIColor whiteColor];
        [bankgroundView setViewShadowWidth:3.0 theCornerRadius:3.0];
        //
        goodsTitleLabel = [[GLGWLabel alloc] initWithFrame:CGRectMake(kWidthProportion_In_iPhoneTriploid(15), kHeightProportion_In_iPhoneTriploid(10), bankgroundView.width - kWidthProportion_In_iPhoneTriploid(62), kHeightProportion_In_iPhoneTriploid(30)) theFont:SYSTEMFONT(16) theColor:kColor_Rule_Black inSuperView:bankgroundView];
        goodsTitleLabel.backgroundColor = kRandomColor;
        goodsTitleLabel.text = @"商品即将售完！";
        //
        goodsNameLabel = [[GLGWLabel alloc] initWithFrame:CGRectMake(goodsTitleLabel.x, kY_With_View(goodsTitleLabel, 5), goodsTitleLabel.width, kHeightProportion_In_iPhoneTriploid(20)) theFont:SYSTEMFONT(14) theColor:[UIColor colorWithHexString:@"#666666"] inSuperView:bankgroundView];
        goodsNameLabel.text = @"商品名：特级螺纹钢HRB2000";
        //
        GLGWImageView * p_imageView = [[GLGWImageView alloc] initWithImageName:@"uu" inSuperView:self];
        p_imageView.backgroundColor = kRandomColor;
        [p_imageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(bankgroundView);
            make.right.equalTo(bankgroundView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(22)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(22)));
        }];
    }
    return self;
}

-(void)setSy_type:(SystemMessagePType)sy_type{
    _sy_type = sy_type;
    if (_sy_type == SystemMessagePType_Nitf) {
        goodsNameLabel.font = SYSTEMFONT(12);
        goodsNameLabel.height = kHeightProportion_In_iPhoneTriploid(17);
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
